<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'title' => '<code>lapis</code> and <code>gems</code>',
	'body' => <<<END
<section id="general">
	<h2>General news</h2>
	<p>
		I copied my documents, then mailed them to Discover.
		Now I just need to wait and see if they&apos;ll keep their word and honour the copies.
	</p>
	<p>
		Yesterday, when I was trying out mineral-defining mods, I ran into two cases of mod name collision.
		Two mods of the same name cannot be installed simultaneously for a few reasons, the main one probably being that each mod gets its own name space to define in-game objects with, and that name space is based on the mod&apos;s name.
		The first collision was with the name <code>gems</code>.
		With such an unoriginal name, how could there <strong>*not*</strong> be a collision?
		One adds gems to make tools from.
		The other adds gems to encrust existing tools with, changing their properties.
		The second collision was with a pair of mods called <code>lapis</code>.
		This collision should have never happened.
		The author of the second mod knew about the first mod, even reusing code from the original.
		You&apos;d think that they share some node/item names because the second is basically a continuation of the first, but you&apos;d be wrong.
		They both define lapis lazuli minerals, but they don&apos;t share an internal identifier and they behave completely differently.
		The second mod also adds pyrite alongside lapis lazuli.
		Nothing about the two mods is the same, so they should use different names so they can be installed together if desired.
		Yesterday, I hatched a plan to merge both pairs to form new mods that take the place of their components, filling both roles, eliminating conflict, and still covering the needs of any mod that depends on either of the component parts.
	</p>
	<p>
		Merging the <code>gems</code> mods might be tricky to pull off in a clean way.
		I&apos;ll need to extend the functionality to include more, potentially allowing all gems defined by the mod to fill either role and defining a bunch of new tools to pull it off.
		I thought the <code>lapis</code> mods would be easier though.
		<code>minestats</code> wasn&apos;t detecting the lapis lazuli ores from the second mod, so I looked into the code.
		It turns out the &quot;mineral&quot; node is craftable.
		It sometimes drops its gem, but usually drops a cobble version of itself, which can be smelted back into its original form.
		However, I thought I read that it could also be crafted into and from nine of its gems.
		In other words, the gem drop is &quot;bad&quot;, as you get less of the material!
		That was an ugly mess and I didn&apos;t like it.
		I figured when I merged the mods, I&apos;d alias the new drop to the old drop, remove the spawning of the new mineral nodes, make the new mineral nodes stop dropping the gems (so they always drop the cobble version of themselves), and make the new nodes craftable from the old gems.
		Nine of the old gem in a square would make the old block.
		Four would make the new block/mineral hybrid.
		This would also help deal with the new-found rarity on the new mod&apos;s end, as it was supposed to spawn full nodes instead of just minerals, so it shouldn&apos;t take a full nine gems to craft them.
	</p>
	<p>
		As I was merging the code today though, I found I&apos;d misread yesterday.
		The new mineral node isn&apos;t craftable from gems, it&apos;s only craftable by smelting its cobble form.
		No material is lost.
		So should I get <code>minestats</code> to count the times it drops the gem instead of the cobble?
		As I debated back and forth, I came up with a way to provide support for this mineral.
		I could check to see if any of the recipes used to craft the node require the exact drop of the node.
		Additionally though, I wondered if I even needed to check to see if the node is craftable at all.
		If I remove that check, the problem is that clay will be counted as a mineral.
		The same clay can be dug and placed repeatedly, boosting your clay count.
		This could be done intentionally, but it could also be done unintentionally when you change your mind about where you wanted the clay placed.
		I was torn, unsure whether this strangely-defined lapis lazuli node was deserving of inclusion as a mineral.
		One of my main thoughts was that with minerals, you can&apos;t choose where they are.
		You can&apos;t have them in your inventory, so you can&apos;t place them to dig them.
		That firmly rules this newer lapis lazuli out as a mineral, right?
		However, after a bit, I realised the inconsistency in that thought.
		I&apos;ve been treating flint as a mineral when it falls from gravel, but gravel usually drops itself.
		That means the mineral node <strong>*can*</strong> exist in-inventory and the player <strong>*can*</strong> chose where to place it.
		This new lapis lazuli is as much a mineral as flint, so because I adamantly hold to the claim that flint counts as a mineral, I <strong>*must*</strong> provide support for this lapis lazuli if feasible, and it&apos;s plenty feasible.
	</p>
	<p>
		After writing code to weed out empty stacks in drop sets, I realised that empty stacks were already weeded out in a better way elsewhere in my code.
		I&apos;d already accounted for them.
		After writing up code to sort drop sets so they could be more-easily compared to craft recipes (I&apos;d use that same function to normalise the recipes), I realised I didn&apos;t need to do that either, and undid all my code work for the day up to that point.
		I don&apos;t need the drops sorted.
		If the node drops multiple item stacks, it&apos;s already eliminated as not a mineral.
		If we know it only drops one item stack, what&apos;s to sort?
	</p>
	<p>
		Having fixed the bug in <code>minestats</code> and having failed to make any progress whatsoever on the mod merge I thought I knew how to complete, I biked around town for a while, exercising, getting some sun, and thinking about both mod mergers.
		On the <code>lapis</code> mod, I came to a new conclusion as to how to complete it.
		For the most part, the mods will remain unchanged, aside from the fact that the two will now be one.
		However, the new <code>lapis</code> mod adds a couple elements.
		First, it adds pyrite.
		Second, it replaces lapis lazuli ore with blocks of lapis lazuli that are filled with calcite.
		At first, I tried to figure out how to change the names of these new lapis lazuli nodes to include the fact that they&apos;ve got calcite, aside from the main ore node, which already has that information.
		However, I settled on a better plan.
		Instead, I&apos;ll label the old lapis lazuli minerals as <strong>*pure*</strong>.
		It&apos;ll get the same point across, and will allow the two to be separated.
		When I have time, it shouldn&apos;t take to long to get it right this time.
		As for the <code>gems</code> mod merger, I&apos;m still lost.
		One one just defines minerals to be made into tools.
		It&apos;s pretty straightforward.
		The other encrusts three sets of tools.
		One set is the steel tools from <code>default</code>.
		The other two are the gold and mithral tools from <code>moreores</code>.
		Mese tools are mentioned as being unencrustable, but no other tools are mentioned.
		I imagine at the point this mod was abandoned, Minetest Game still only had wooden, stone, steel, and mese tools.
		It might not have even had the full mese set yet.
		At this point though, Minetest Game&apos;s <code>default</code> has bled <code>moreores</code> all but dry.
		Only two minerals are left in <code>moreores</code>: silver and mithral.
		Golden tools no longer exist.
		I think the obvious thing to do is extend support to all <code>default</code> and <code>moreores</code> tools, including mese, and just forget about golden tools.
		I can then bump up the bonuses for the encrusting gems, and make the tool gems have lower-level encrusting bonuses.
		I can add low-level tools that can be made from the encrusting gems as well.
		That way, the gems can be used for either purpose, but they work best for their respective, original purposes.
		I&apos;ll need to create textures for the blocks crafted from the encrusting gems, as the tools gems allow themselves to be crafted into nodes and the encrusting gems don&apos;t yet, and I&apos;ll need to do something with the fact that the tools gems define a way to make tool handles out of stone, but all that will be mostly reasonable to accomplish.
		The problem though, will be the diamonds in the encrusting <code>gems</code> mod.
		This mod&apos;s old and, as I said before, seems to predate the most recent tool sets.
		It defines diamonds because diamonds didn&apos;t yet exist.
		Defining diamonds in the new version of this mod could be a mess if I don&apos;t do it right, but removing them would in part defeat the purpose of this merger.
		I <strong>*must*</strong> include them.
	</p>
	<p>
		One possibility I&apos;m thinking about is to define them as low-grade diamonds or something.
		Perhaps they&apos;re not fit for their original purpose, and the diamonds in <code>default</code> will fill that role.
		Or perhaps, they make tools that are half the strength of regular diamond tools and have half the encrusting bonus of the regular diamonds.
		Or maybe, you craft together several low-grade diamonds to get a usable diamond.
	</p>
	<p>
		My new Oregon Community Credit Union credit card arrived today.
		I stopped using my old one when I found I could choose a name on my Discover card, but Discover revoked that feature and I now have the legal name I want anyway.
		I might actually use this new card.
		The utility bill also arrived, but by the time I checked the mail, the utility company&apos;s office was closed.
		Maybe I&apos;ll pay the bill tomorrow when I get home from this food-getting thing.
	</p>
	<p>
		My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
	</p>
</section>
<section id="dreams">
	<h2>Dream journal</h2>
	<p>
		I don&apos;t remember most of this dream, but the last part is still vivid in my mind.
		Vanessa, our mother, and I were in my mother&apos;s car, off in the wilderness, on a thin, dirt road on a slope by the waster.
		I had a newspaper that I was using to keep track of the events of the day with.
		Somehow, what I was going to write in my journal related to the content of the newspaper.
		However, Vanessa wanted to take my newspaper for something; I don&apos;t recall what.
		I scoured the newspaper to find the parts I needed, and took notes on my laptop so I wouldn&apos;t need the paper any more before giving it up.
		I found an article about Trump; I don&apos;t recall the specifics of what it said, but the article included a life-size balloon of Trump, uninflated and folded into the newspaper.
		I jokingly asked our mother if they wanted the balloon.
		I didn&apos;t mean any harm by it, but ...
	</p>
	<p>
		My mother asked how it was in my apartment, no longer having to share a kitchen with someone of such drastically-different political views, referring to themself.
		I said I didn&apos;t mind sharing a kitchen, it didn&apos;t affect the quality of the food.
		That&apos;s when my mother got mean.
		They said it did, that when someone with a warm heart makes the food, you can taste the care they put into it.
		In other words, they were saying that I must have a cold heart, as I voted against Trump.
		At that point, I retaliated.
		Somehow, my mother appeared outside the vehicle though, so they didn&apos;t hear me.
		At that point, the road had a large dip in it, and without a driver, it nearly fell off the road.
		Once the car had come to a stop, I got out and repeated myself: &quot;If you had a warm heart, you&apos;d have voted for anyone but the republican.&quot;, adding onto the end, &quot;If you didn&apos;t like the democrat, you could&apos;ve even written in a candidate.&quot;.
	</p>
	<p>
		Somehow, the story of the dream got rewritten at that point.
		My mother was holding their cat, and had been frustrated for a while, not sure how to handle moving the cat in their upcoming move.
		In exasperation from my words, they simply gave up, and released the cat by the road.
		They made sudden, startling motions to scare the already-nervous cat (the cat fears unknown environments) down the slope and to the lake, where two black cats already were.
		The cat would never survive there though.
		It doesn&apos;t know how to hunt or avoid predators.
		In releasing the cat, my mother sort of proved my point.
		I cried a bit, knowing I&apos;d unintentionally played a hand in the cat&apos;s soon-to-be, untimely demise.
		I briefly considered the fact that I might, myself, be stranded too; that my mother wouldn&apos;t bring me back home from our outing.
		That was about when I woke up.
	</p>
	<p>
		The ironic thing about the kitchen remark from my mother, and something I didn&apos;t even consider until I was awake, is that my mother doesn&apos;t pour love and care into meals.
		Additionally, when I was living there, I couldn&apos;t keep edible food around, or my mother would complain.
		I practically lived off of whatever I could buy and eat quickly.
		No large bags of potatoes, no vegetables that had to be stored in the refrigerator ... even canned goods were too much, as they were a pain to eat while out and I felt like I couldn&apos;t bring food home.
		I was eating mostly junk food such as potato chips.
		In the dream, I didn&apos;t mind sharing a kitchen with my mother.
		In the real world, I do.
	</p>
</section>
END
);
